package pcserver;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.ImageIcon;
import javax.swing.JButton;

public class ImageBtn extends JButton {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private ImageIcon normal;
	private ImageIcon on;
	
	public ImageBtn(ImageIcon normal){
		this.normal = normal;
		this.on = normal;
		this.setIcon(this.normal);
		this.addMouseListener(new BtnListener());
		this.setOpaque(false);
		this.setFocusable(false);
        this.setBorder(null);
        this.setContentAreaFilled(false);
	}
	
	public ImageBtn(ImageIcon normal, ImageIcon on){
		this.normal = normal;
		this.on = on;
		this.setIcon(this.normal);
		this.addMouseListener(new BtnListener());
		this.setOpaque(false);
		this.setFocusable(false);
        this.setBorder(null);
        this.setContentAreaFilled(false);
	}
	
	private class BtnListener implements MouseListener{

		@Override
		public void mouseClicked(MouseEvent arg0) {
			// TODO Auto-generated method stub
			
		}

		@Override
		public void mouseEntered(MouseEvent arg0) {
			// TODO Auto-generated method stub
			setIcon(on);
		}

		@Override
		public void mouseExited(MouseEvent arg0) {
			// TODO Auto-generated method stub
			setIcon(normal);
		}

		@Override
		public void mousePressed(MouseEvent arg0) {
			// TODO Auto-generated method stub
		}

		@Override
		public void mouseReleased(MouseEvent arg0) {
			// TODO Auto-generated method stub
			
		}
	
	}
	
	
}
